package com.aaa.sbms.service;

import com.aaa.sbms.dao.RepairDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class RepairServiceImpl implements RepairService{
    @Autowired
    private RepairDao repairDao;

    @Override
    public Map getList(Map map) {
        int pageNo = Integer.valueOf(map.get("pageNo")+"");
        int pageSize = Integer.valueOf(map.get("pageSize")+"");
        PageHelper.startPage(pageNo,pageSize);
        //PageHelper.offsetPage(pageNo,pageSize);
        PageInfo<Map> pageInfo = new PageInfo<Map>(repairDao.list(map));
        Map rmap  = new HashMap();
        rmap.put("total",pageInfo.getTotal());
        rmap.put("page",pageInfo.getList());
        return rmap;
    }

    @Override
    public int updateIng(Integer ROOM) {
        return repairDao.updateIng(ROOM);
    }

}
